package com.wxq.blog.controller;

import com.wxq.blog.common.aop.LogAnnotation;
import com.wxq.blog.service.CategoryService;
import com.wxq.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    @LogAnnotation(module = "类型",operation = "获取文章所有类型")//加入aop切面输出日志
    public Result listCategory() {
        return categoryService.findAll();
    }
    @GetMapping("detail")
    @LogAnnotation(module = "类型",operation = "获取文章所有类型详情")//加入aop切面输出日志
    public Result categoriesDetail(){
        return categoryService.findAllDetail();
    }
    @GetMapping("detail/{id}")
    @LogAnnotation(module = "类型",operation = "通过文章id获取文章所有类型详情")//加入aop切面输出日志
    public Result categoriesDetailById(@PathVariable("id") Long id){
        return categoryService.categoriesDetailById(id);
    }

}
